#ifndef ROWSMODEL_H_
#define ROWSMODEL_H_

#include "ModelComposite.h"
#include "RowModel.h"
#include "Position.h"
#include "Players.h"

class RowsModel : public ModelComposite
{
public:
    RowsModel(PlayersPtr players, unsigned int widthOfWell);
    virtual ~RowsModel();

    void init();
    void addBlocksAt(const Positions& positions, int playerId);
    void removeFullRows(int playerId);
    bool hasEmptySpaceAt(const Position& position);

private:
    void removeFullRow(RowModel* row);
    void addRow(int rowNo);
    void addRows(int noOfRows);
    RowModels getFullRows();
    void updateScore(int playerId, int noOfRows);
    bool isInsideWell(const Position& position);
    bool noExistingBlock(const Position& position);

    RowModels rows;
    PlayersPtr players;
    unsigned int widthOfWell;
};

#endif
